package com.kxmall.web.controller.huishouapp;

import cn.dev33.satoken.annotation.SaIgnore;
import com.kxmall.common.core.controller.BaseAppController;
import com.kxmall.common.core.domain.PageQuery;
import com.kxmall.common.core.domain.R;
import com.kxmall.common.core.page.TableDataInfo;
import com.kxmall.huishou.domain.bo.HsUserWasteBo;
import com.kxmall.huishou.domain.vo.HsUserWasteVo;
import com.kxmall.huishou.service.IHsUserWasteService;
import com.kxmall.user.domain.KxUser;
import com.kxmall.user.domain.bo.KxUserBillBo;
import com.kxmall.user.domain.vo.KxUserBillVo;
import com.kxmall.user.service.IUserBillService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;

/**
 * 账户统计
 *
 * @author lyics
 * @date 2023-12-01
 */

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/account/app")
public class HsAppAccountStatisticsController extends BaseAppController {

    private final IUserBillService iUserBillService;

    /**
     * 查询账户统计列表
     */
    @GetMapping("/getAccountPageList")
    public TableDataInfo<KxUserBillVo> getOrderPageLists(KxUserBillBo bo, PageQuery pageQuery){

        Long userId = getLoginUser().getUserId();
        if(bo == null){
            bo = new KxUserBillBo();
        }
        bo.setUid(userId);
        bo.setStatus(1);

        return iUserBillService.queryPageList(bo,pageQuery);
    }


    /**
     * 获取账户统计详细信息
     *
     * @param id 主键
     */
    @GetMapping("/{id}")
    public R<KxUserBillVo> getInfo(@NotNull(message = "主键不能为空")@PathVariable Long id) {
        return R.ok(iUserBillService.queryById(id));
    }










}
